package com.lkbaby.proxy.jdk;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * 动态处理器
 */
public class DynamicProxyHandler implements InvocationHandler {

	Object object;

	public DynamicProxyHandler(Object object) {
		this.object = object;
	}

	@Override
	public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {

		System.out.println("buy car before ...");
		Object invoke = method.invoke(object, args);
		System.out.println("buy car after ...");
		return invoke;
	}
}
